package com.shopoo.oauth.domain.enums;

/**
 * @Description 用户状态
 * @Date 2020/6/17 6:52 下午
 * @Author <a href="mailto:android_li@sina.cn">Joe</a>
 **/
public enum StatusEnum {
    ENABLE((short)1, "启用"),
    DISABLED((short)0, "禁用");

    private Short value;
    private String name;

    public Short getValue() {
        return value;
    }

    public String getName() {
        return name;
    }

    StatusEnum(Short value, String name) {
        this.value = value;
        this.name = name;
    }

    /**
     * @Description 获取用户状态
     *
     * @Param [status]
     * @Return java.lang.String
     * @Date 7:00 下午 2020/6/17
     * @Author <a href="mailto:android_li@sina.cn">Joe</a>
     */
    public static String getStatus(short status) {
        for (StatusEnum userStatus: StatusEnum.values()) {
            if (userStatus.value == status) {
                return userStatus.name;
            }
        }
        throw new IllegalArgumentException("未知的用户状态：" + status);
    }
}
